package com.heima.user.controller;

import com.heima.common.dto.ResponseResult;
import com.heima.user.dto.AuthDto;
import com.heima.user.service.IApUserRealnameService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * APP实名认证信息表  前端控制器
 */
@RestController
@RequestMapping("/api/v1/user_realname")
@Api(tags = "APP实名认证信息表接口")
@CrossOrigin
public class ApUserRealnameController {


    @Autowired
    private IApUserRealnameService apUserRealnameService;


    /**
     * 按照状态查询用户认证列表
     * @param dto
     * @return
     */
    @PostMapping("/list")
    @ApiOperation(value = "listByStatus",notes = "根据状态查询实名认证列表数据")  // value指名称  notes  备注
    @ApiModelProperty(name = "dto",dataType = "AuthDto",required = true)
    public ResponseResult listByStatus(@RequestBody AuthDto dto){
        return apUserRealnameService.listByStatus(dto);
    }

    /**
     * 审核失败
     * @param dto
     * @return
     */
    @PostMapping("/authFail")
    @ApiOperation(value = "authFail",notes = "实名认证驳回")  // value指名称  notes  备注
    @ApiModelProperty(name = "dto",dataType = "AuthDto",required = true)
    public ResponseResult authFail(@RequestBody AuthDto dto){
        return apUserRealnameService.auth(dto,0);  //实名认证驳回
    }
}
